
public class FallBlock extends Map implements Runnable{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	Map panel;

	FallBlock(Map m){
		panel = m;
	}

	public void run(){
		fallBlock(panel.map);
		add = new AddBlock();
		add.addBlock(panel.map);
	}

	public void fallBlock(int[][] map){
		for(int i = 0; i <8; i++){
			for(int j = 0; j < 8; j++){
				if(map[j][i] == 7){
					for(int k = i; k >= 0; k--){
						map = upBlock(map, k, j);
					}
					panel.stop(100);
				}
			}
		}
	}

	public int[][] upBlock(int map[][], int i, int j){
		try{
			int n = map[j][i];
			map[j][i] = map[j][i-1];
			map[j][i-1] = n;
		}catch(Exception e){
			//System.out.println(e);
			map[j][i] = 7;
		}
		return map;
	}


}
